<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //         数组练习:
      // 1.实现一个函数push，向数组末尾添加一个元素
      // var arr = [1,2,3];
      // push(arr,4)

      var arr = [1, 2, 3];
      function push(arr, val) {
        for (var i = 0; i < arguments.length; i++) {
          arr[arr.length] = val;
        }
        console.log(arr);
      }
      push(arr, 4);

      var a = b;
    </script>
  </body>
</html>
